var plist
var pageIndex = 1
var pageSize = 20
var app = new Vue({
  el: '#qq',
  data: {
    //fid: getUrlMsg(),
    plist: getAllFeastApply(pageIndex, pageSize),
    Vid: '',
    f_id: '',
    a_id: '',
    vreason: '',
    vnotic: '',
    apply_time: '',
    is_dis: '',
    is_apply: ''
  },
  methods: {
    setMsg(id, f_id, a_id, reason, notic, apply_time, is_dis, is_apply) {
      $('#tt').show(1000)
      // alert('8')
      app.Vid = id
      app.f_id = f_id
      app.a_id = a_id
      app.vreason = reason
      app.vnotic = notic
      app.apply_time = apply_time
      app.is_dis = is_dis
      app.is_apply = is_apply
      // $('#tt').show(1000)
    }
  }
})

// function getCookin() {
//   if ($.cookie('coolie_ReadMsg') != null) {
//     cookie_Carts = JSON.parse($.cookie('cookie_Carts'))
//     return cookie_Carts[0].id
//   } else {
//     return 0
//   }
// }
//查询所有饭局
function getAllFeastApply() {
  $.ajax({
    url: 'http://47.102.45.219:8080/Appoint/UserServlet/getAllFeastApply',
    async: false,
    dataType: 'json',
    success: function (data) {
      plist = data.data
    }
  })
  return plist
}
var id

function deleteFeastApply(id) {
  $('#tt').hide(1000)
  $.ajax({
    url: 'http://47.102.45.219:8080/Appoint/UserServlet/deleteFeastApply',
    data: {
      id: id
    },
    async: false,
    dataType: 'json',
    success: function (data) {
      alert('删除成功')
    }
  })

  app.plist = getAllFeastApply(pageIndex, pageSize)
}
// //页面传来用户id
// var str

// function getUrlMsg() {
//   var str = location.href
//   var num = str.indexOf("=")
//   str = str.substr(num + 1)
//   fid = str

//   return str;

// }

// $(function () {
//   // alert(judgeFriend(myid,hisId))
//   if (judgeFriend(myid, fid)) {
//     app.friend = "已关注"
//     // app.friendstaut="取消关注"
//   } else {
//     app.friend = "未关注"
//     // app.friendstaut="关注"
//   }

// })
function feastApplyAdd() {
  $.ajax({
    url: 'http://47.102.45.219:8080/Appoint/UserServlet/feastApplyAdd',
    data: $('#we').serialize(),
    async: false,
    type: 'post',
    dataType: 'json',
    success: function (data) {
      alert('添加成功')
    }
  })
  xadmin.close()
  xadmin.father_reload()
  app.plist = getAllFeastApply()
}

function closePageForm() {
  window.opener = null
  window.open('', '_self')
  window.close()
}

// function updata(id) {
//   plist[i].id
// }

function adds() {
  $('#tt').show(1000)
}

function updataFeastApply() {
  $.ajax({
    url: 'http://47.102.45.219:8080/Appoint/UserServlet/updataFeastApply',
    data: $('#tt').serialize(),
    async: false,
    type: 'post',
    dataType: 'json',
    success: function (data) {
      alert('修改成功')
    }
  })
  $('#tt').hide(1000)
  app.plist = getAllFeastApply(pageIndex, pageSize)
}

var blist
var hh

function getAllFeastApplyById() {
  hh = $('#byid').val()
  $.ajax({
    url: 'http://47.102.45.219:8080/Appoint/UserServlet/getAllFeastApplyById',
    data: {
      id: hh
    },
    async: false,
    dataType: 'json',
    success: function (data) {
      blist = data.data
    }
  })
  plist = blist
  return plist
}